﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.iOS.OnDemandResourcesRequest
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.iOS
{
  /// <summary>
  ///   <para>Represents a request for On Demand Resources (ODR). It's an AsyncOperation and can be yielded in a coroutine.</para>
  /// </summary>
  [NativeHeader("Runtime/Export/iOS/OnDemandResources.h")]
  [UsedByNativeCode]
  [StructLayout(LayoutKind.Sequential)]
  public sealed class OnDemandResourcesRequest : AsyncOperation, IDisposable
  {
    /// <summary>
    ///   <para>Returns an error after operation is complete.</para>
    /// </summary>
    public extern string error { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    /// <summary>
    ///   <para>Sets the priority for request.</para>
    /// </summary>
    public extern float loadingPriority { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Gets file system's path to the resource available in On Demand Resources (ODR) request.</para>
    /// </summary>
    /// <param name="resourceName">Resource name.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern string GetResourcePath(string resourceName);

    [ThreadSafe]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private static extern void DestroyFromScript(IntPtr ptr);

    /// <summary>
    ///   <para>Release all resources kept alive by On Demand Resources (ODR) request.</para>
    /// </summary>
    public void Dispose()
    {
      if (this.m_Ptr != IntPtr.Zero)
      {
        OnDemandResourcesRequest.DestroyFromScript(this.m_Ptr);
        this.m_Ptr = IntPtr.Zero;
      }
      GC.SuppressFinalize((object) this);
    }

    internal OnDemandResourcesRequest()
    {
    }

    ~OnDemandResourcesRequest() => this.Dispose();
  }
}
